interface _CR_ {
    /** 颜色 */
    colors: {
        hex: RegExp,
        $hex: RegExp,
        hex_alpha: RegExp,
        $hex_alpha: RegExp,
        rgb: RegExp,
        rgba: RegExp,
        name: RegExp,
        _names_: { [key: string]: string }
    };
}
{
    const R0_255 = '(' + '25[0-5]' + '|' + '2[0-4][0-9]' + '|' + '1[0-9][0-9]' + '|' + '[1-9][0-9]' + '|' + '[0-9]' + ')';
    const comma = '\\,';
    const spaces = '[ ]*';
    const spaces_R0_255_R0_255 = spaces + R0_255 + spaces;

    const names = {
        'transparent': 'transparent',
        'red': '#ff0000',
        'orange': '#ffa500',
        'yellow': '#ffff00',
        'green': '#008000',
        'cyan': '#00ffff',
        'blue': '#0000ff',
        'purple': '#800080',
        'black': '#000000',
        'white': '#ffffff',
        'gray': '#808080',
        'pink': '#ffc0cb',
        'brown': '#a52a2a',
        'gold': '#ffd700',
    };

    Object.defineProperty(_CR_.prototype, 'colors', {
        writable: false,
        configurable: false,
        enumerable: false,
        value: {
            hex: /^([A-Fa-f0-9]{3}){1,2}$/,
            $hex: /^#([A-Fa-f0-9]{3}){1,2}$/,
            hex_alpha: /^[A-Fa-f0-9]{8}$/,
            $hex_alpha: /^#[A-Fa-f0-9]{8}$/,
            rgb: new RegExp(`^${spaces}rgb${spaces}\\(${spaces_R0_255_R0_255}${comma}${spaces_R0_255_R0_255}${comma}${spaces_R0_255_R0_255}\\)${spaces}$`),
            rgba: new RegExp(`^${spaces}rgba${spaces}\\(${spaces_R0_255_R0_255}${comma}${spaces_R0_255_R0_255}${comma}${spaces_R0_255_R0_255}${comma}${spaces_R0_255_R0_255}\\)${spaces}$`),
            name: new RegExp(`^(${Object.keys(names).join('|')})$`),
            _names_: names,
        }
    });
}
